package com.maoxx.stuchoosemssbv_service.controller;

import com.maoxx.stuchoosemssbv_service.entity.Course;
import com.maoxx.stuchoosemssbv_service.entity.CourseTeacher;
import com.maoxx.stuchoosemssbv_service.entity.CourseTeacherInfo;
import com.maoxx.stuchoosemssbv_service.entity.CourseTeacherRowsDTO;
import com.maoxx.stuchoosemssbv_service.service.CourseTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @className: CourseTeacherController
 * @author: Maoxx
 * @date: 2024/11/4 23:07
 * @Version: 1.0
 * @description:
 */


@RestController
@RequestMapping("/courseTeacher")
@CrossOrigin(origins = "*")
public class CourseTeacherController {

    @Autowired
    private CourseTeacherService courseTeacherService;

    @DeleteMapping("/deleteById")
    public boolean deleteById(@RequestBody CourseTeacherRowsDTO courseTeacherRowsDTO) {
        System.out.println("删除课程教师信息：" + courseTeacherRowsDTO);
        return courseTeacherService.deleteById(courseTeacherRowsDTO);
    }

    @GetMapping("/findCourseTeacherInfo")
    public List<CourseTeacherInfo> findCourseTeacherInfo() {
        return courseTeacherService.findCourseTeacherInfo();
    }

    @GetMapping("/findMyCourse/{tid}/{term}")
    public List<Course> findMyCourse(@PathVariable Integer tid, @PathVariable String term) {
        return courseTeacherService.findMyCourse(tid, term);
    }

}
